home *** CD-ROM | disk | FTP | other *** search
- On 15-Apr-97, Mush sat on a keyboard and produced this mess:
-
- > >> OK, ill try and explain this problem again. Im making a perspective
- > >> box/rectangle, so naturally, one end will be close, and the other end
- > >> smaller, so simulate the depth of the box. Here is an example: (crap
- > ASCII art)
- > >>
- > >> |
- > >> |
- > >> | |
- > >> | |
- > >> |
- > >> |
-
- > >Surely, if you have already drawn the vertical lines on screen, all the
- > >necessary co-ords will be contained within the variables that set them?
- > >
- > >Or have I mis-understood?
-
- > I know the top coords of the 2 lines drawn, but it is the top and bottom Y
- > coordinates on the actual SLOPES that I need to know quickly
-
- OK, I think I understand this problem now. Hopefully, this program
- should solve your problem...
-
- X1=10 : X2=95 : Rem Left and right edge x positions
- YTOP1=30 : YTOP2=50 : Rem Top coordinates
- YBOT1=150 : YBOT2=115 : Rem Bottom coordinates
-
- ' Draw verticle sides
- Draw X1,YTOP1 To X1,YBOT1
- Draw X2,YTOP2 To X2,YBOT2
-
- ' Get gradients of lines (*256 so it is int and power of 2 for speed)
- GRADTOP=(256*(YTOP2-YTOP1))/(X2-X1)
- GRADBOT=(256*(YBOT2-YBOT1))/(X2-X1)
-
- For X=X1 To X2
- ' Get coordinates at current x position
- YTOP=YTOP1+((X-X1)*GRADTOP)/256
- YBOT=YBOT1+((X-X1)*GRADBOT)/256
- ' Plot the top and bottom points
- Plot X,YTOP
- Plot X,YBOT
- Next X
-
- Bye ____________________________________________________
- / \
- / Ben Wyatt - bwyatt@paston.co.uk or b.wyatt@uea.ac.uk \
- \ http://www.paston.co.uk/users/bwyatt/index.html /
- \____________________________________________________/
- (c)1995-97 Very Interesting Signatures Ltd.
-
-
-